#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

int main()
{
    int n;
    cin >> n;
    while (n -- )
    {
        int t;
        cin >> t;
        int res = 0;
        while(t) t -= (t & -t), res++;
        cout << res << ' ';
    }
    return 0;
}